---
title: 'log | Cypress Documentation'
description: Print a message to the Cypress Command Log.
sidebar_label: log
slug: /api/commands/log
---

<ProductHeading product="app" />

# log

Print a message to the Cypress Command Log.

## Syntax

```javascript
cy.log(message)
cy.log(message, args...)
```

### Usage

<Icon name="check-circle" color="green" /> **Correct Usage**

```javascript
cy.log('created new user')
```

### Arguments

<Icon name="angle-right" /> **message _(String)_**

Message to be printed to Cypress Command Log. Accepts a Markdown formatted
message.

<Icon name="angle-right" /> **args...**

Additional arguments to be printed to the Cypress Command Log. There is no limit
to the number of arguments.

<HeaderYields />

- `cy.log()` yields `null`.

## Examples

### Message

#### Print a message to the Command Log.

```javascript
cy.click('Login')
cy.log('Login successful')
```

### Args

#### Print a message with arguments to the Command Log.

```javascript
cy.log('events triggered', events)
```

## Rules

<HeaderRequirements />

- `cy.log()` requires being chained off of `cy`.

<HeaderAssertions />

- `cy.log()` cannot have any assertions chained.

<HeaderTimeouts />

- `cy.log()` cannot time out.

## Command Log

**_Print messages with arguments to the Command Log._**

```javascript
cy.log('log out any message we want here')
cy.log('another message', ['one', 'two', 'three'])
```

The commands above will display in the Command Log as:

<DocsImage
  src="/img/api/log/custom-command-log-with-any-message.png"
  alt="Command Log log"
/>

When clicking on `log` within the command log, the console outputs the
following:

<DocsImage
  src="/img/api/log/console-shows-logs-message-and-any-arguments.png"
  alt="Console Log log"
/>

## See also

- [`cy.exec()`](/api/commands/exec)
- [`Cypress.log`](/api/cypress-api/cypress-log)
- [`cy.task()`](/api/commands/task)
